<div class="span-18 options-holder">
	<?= $this->partial('_partial/common_head.phtml', array('controller' => 'category')) ?>
</div>
<div class="span-4 last options-holder">
	<ul class="options-list top-right">
		<li><a title="Dodaj kategorię" class="action add" href="<?php
	    	print $this->url(array(
	  			'controller'=>'category',
	  			'action'=>'add'
    		));
	    ?>">Dodaj kategorię</a></li>
	</ul>
</div>

<hr class="bottom"/>

<table>
  <col span="2"/>
  <col class="even" span="4"/>
 <thead>
  <tr>
    <th>Nazwa</th>
    <th class="span-5">Url</th>
    <th class="span-1">&nbsp;</th>
    <th class="span-1">&nbsp;</th>
    <th class="span-1">&nbsp;</th>
    <th class="span-1">&nbsp;</th>
  </tr>
 </thead>
 <tbody>
  <?php if(count($this->rowset) < 1): ?>

   <tr>
    <td colspan="6"><p class="msg-notice bottom">Brak rekordów</p></td>
   </tr>

  <?php else: ?>

  <?php foreach ($this->rowset as $row): ?>
  <tr>
    <td>
    	<?php print str_repeat('&nbsp;&nbsp;&nbsp;', $row->depth) ?>
    	<a href="<?php
	    	print $this->url(
	    		array(
		  			'controller'=>'category',
		  			'action'=>'edit',
		  			'id' => $row->id
	    		)
	    	);
    	?>"><?php print $row->name ?></a>
    </td>
    <td><?php print $row->url ?></td>
    <td class="center">
    	<?php
    		if ($row->publicated == 1) {
    			$publicatedActionClass = 'true';
    			$publicatedValue = 0;
    		} else {
    			$publicatedActionClass = 'false';
    			$publicatedValue = 1;
    		}
    	?>
    	<a
    		title="Publikuj"
    		class="action ico small <?= $publicatedActionClass ?>"
    		href="<?php
		    	print $this->url(
		    		array(
		    			'controller'=>'category',
			  			'action'=>'modify',
			  			'id' => $row->id,
		    			'm_publicated' => $publicatedValue
		    		));
    	?>">publikacja</a>
    </td>
    <td><a class="action add small" href="<?php
    	print $this->url(
    		array(
	  			'controller'=>'category',
	  			'action'=>'add',
	  			'parent_id' => $row->id
    		)
    	);
    ?>">dodaj</a></td>
    <td><a class="action edit small" href="<?php
    	print $this->url(
    		array(
	  			'controller'=>'category',
	  			'action'=>'edit',
	  			'id' => $row->id
    		)
    	);
    ?>">edytuj</a></td>
    <td class="center"><a
    	title="Usuń"
    	onclick="return confirm('Czy usunąć rekord?');"
    	class="action trash ico small" href="<?php
    	print $this->url(
    		array(
	  			'controller'=>'category',
	  			'action'=>'delete',
	  			'id' => $row->id
    		)
    	);
    ?>">usuń</a></td>
  </tr>
  <?php endforeach; ?>

  <?php endif; ?>
 </tbody>
</table>
